home *** CD-ROM | disk | FTP | other *** search
- # Commands covered: llength
- #
- # This file contains a collection of tests for one or more of the Tcl
- # built-in commands. Sourcing this file into Tcl runs the tests and
- # generates output for errors. No output means no errors were found.
- #
- # Copyright 1991 Regents of the University of California
- # Permission to use, copy, modify, and distribute this
- # software and its documentation for any purpose and without
- # fee is hereby granted, provided that this copyright notice
- # appears in all copies. The University of California makes no
- # representations about the suitability of this software for any
- # purpose. It is provided "as is" without express or implied
- # warranty.
- #
- # $Header: /sprite/src/lib/tcl/tests/RCS/llength.test,v 1.1 91/09/06 14:48:03 ouster Exp $ (Berkeley)
-
- if {[string compare test [info procs test]] == 1} then {source defs}
-
- test llength-1.1 {length of list} {
- llength {a b c d}
- } 4
- test llength-1.2 {length of list} {
- llength {a b c {a b {c d}} d}
- } 5
- test llength-1.3 {length of list} {
- llength {}
- } 0
-
- test llength-2.1 {error conditions} {
- list [catch {llength} msg] $msg
- } {1 {wrong # args: should be "llength list"}}
- test llength-2.2 {error conditions} {
- list [catch {llength 123 2} msg] $msg
- } {1 {wrong # args: should be "llength list"}}
- test llength-2.3 {error conditions} {
- list [catch {llength "a b c \{"} msg] $msg
- } {1 {unmatched open brace in list}}
-